import axios from 'axios'
window.sessionStorage


export function request(config) {
  const instance = axios.create({
    baseURL: 'http://58.67.157.136:51010/psgs-test',
    tiemout: 5000
  })

  instance.interceptors.request.use(config => {
    const token = sessionStorage.getItem('token')
    if(token) {
      config.params.token = token
    }
    return config
  },
  err => {
    console.log(err);
  })
  instance.interceptors.response.use(res => {
    return res.data
  },
  err => {
    console.log(err);
  })
  return instance(config)
}
